package com.android.BluethootChess.model;

import android.graphics.Point;

/**
 * Reprezinta un patrulater, folosind doar punctele de inceput si sfarsit a unei
 * diagonale.
 * */
public class Square {
	private Point lowerPoint;
	private Point higherPoint;

	public Square(Point lower, Point higher) {
		lowerPoint = lower;
		higherPoint = higher;
	}

	/**
	 * Verifica daca p este in interiorul patrulaterului.
	 * 
	 * @param p
	 *            - punctul care se testeaza.
	 * @return - true punctul se afla in patrulater - fals in caz contror.
	 * */
	public boolean belongToSquare(Point p) {
		if ((p.x >= lowerPoint.x && p.x <= higherPoint.x)
				&& (p.y >= lowerPoint.y && p.y <= higherPoint.y)) {
			return true;
		}
		return false;
	}

	public Point getLowerPoint() {
		return lowerPoint;
	}

	public Point getHigherPoint() {
		return higherPoint;
	}
	
	
}
